package org.dreamwork.jasmine2.restful;

import com.google.gson.annotations.Expose;

/**
 * Created with IntelliJ IDEA.
 * User: seth.yang
 * Date: 14-11-17
 * Time: 下午7:59
 */
public class RestfulAPIErrorMessage {
    @Expose
    private int code;
    @Expose
    private String message;

    public RestfulAPIErrorMessage () {
    }

    public RestfulAPIErrorMessage (int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode () {
        return code;
    }

    public void setCode (int code) {
        this.code = code;
    }

    public String getMessage () {
        return message;
    }

    public RestfulAPIErrorMessage setMessage (String message) {
        this.message = message;
        return this;
    }

    public static final int OK_CODE = 0x0000;
    public static final int METHOD_NOT_SUPPORTED_CODE = 0x0001;
    public static final int PARAMETER_INVALID_CODE = 0x0002;
    public static final int MISSING_REQUIRED_CONTEXT_PARAMETER_CODE = 0x0003;
    public static final int MISSING_API_PARAMETER_CODE = 0x0004;
    public static final int MISSING_APP_ID_CODE = 0x0005;
    public static final int INVALID_KEK_CODE = 0x0006;
    public static final int BEFORE_EXECUTE_FAIL_CODE = 0X0007;
    public static final int ENCRYPT_FORCED_CODE = 0x0008;
    public static final int API_NOT_FOUND_CODE = 0x0009;
    public static final int INTERNAL_SERVER_ERROR_CODE = 0x000a;

    public static final RestfulAPIErrorMessage OK =
            new RestfulAPIErrorMessage (OK_CODE, "OK");
    public static final RestfulAPIErrorMessage METHOD_NOT_SUPPORTED =
            new RestfulAPIErrorMessage (METHOD_NOT_SUPPORTED_CODE, "Method NOT supported.");
    public static final RestfulAPIErrorMessage PARAMETER_INVALID =
            new RestfulAPIErrorMessage (PARAMETER_INVALID_CODE, "Parameter invalid.");
    public static final RestfulAPIErrorMessage MISSING_REQUIRED_CONTEXT_PARAMETER =
            new RestfulAPIErrorMessage (MISSING_REQUIRED_CONTEXT_PARAMETER_CODE, "Missing required context parameter");
    public static final RestfulAPIErrorMessage MISSING_API_PARAMETER =
            new RestfulAPIErrorMessage (MISSING_API_PARAMETER_CODE, "Missing api parameter");
    public static final RestfulAPIErrorMessage MISSING_APP_ID =
            new RestfulAPIErrorMessage (MISSING_APP_ID_CODE, "Missing app id");
    public static final RestfulAPIErrorMessage INVALID_KEK =
            new RestfulAPIErrorMessage (INVALID_KEK_CODE, "Invalid kek");
    public static final RestfulAPIErrorMessage BEFORE_EXECUTE_FAIL =
            new RestfulAPIErrorMessage (BEFORE_EXECUTE_FAIL_CODE, "Before Execute Fail");
    public static final RestfulAPIErrorMessage ENCRYPT_FORCED =
            new RestfulAPIErrorMessage (ENCRYPT_FORCED_CODE, "Encrypt forced, but the data seems not be encrypted.");
    public static final RestfulAPIErrorMessage API_NOT_FOUND =
            new RestfulAPIErrorMessage (API_NOT_FOUND_CODE, "API NOT found.");
}